/****************************************************************************
   Copyright 2013 Stacy Doss

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
****************************************************************************/

#ifndef _DEF_H
#define _DEF_H

#include <string>
#include <map>
#include <vector>
#include "Enums.h"
#include "Rect.h"
#include "DefTrack.h"
#include "DefGCellGrid.h"
#include "DefComponent.h"
#include "DefPin.h"
#include "DefNet.h"
#include "DefComponentConnection.h"

namespace def {
	class Def {
		private:
		std::map<std::string, std::string>	_stringAttributes;
		std::map<std::string, int>			_intAttributes;
		std::map<std::string, double>		_floatAttributes;
		std::map<std::string, bool>			_boolAttributes;
		util::Rect*							_dieArea;
		std::vector<def::Track*>*			_tracks;
		std::vector<def::GCellGrid*>*		_gCellGrids;
		std::vector<def::Component*>*		_components;
		std::vector<def::Pin*>*				_pins;
		std::vector<def::Net*>*				_nets;

		protected:

		public:
			Def();
			~Def();

			int load(char* filename);

			int addAttribute(std::string name, char* value);
			int addAttribute(std::string name, std::string value);
			int addAttribute(std::string name, int value);
			int addAttribute(std::string name, double value);
			int addAttribute(std::string name, bool value);

			std::string getStringAttribute(std::string name);
			int         getIntAttribute(std::string name);
			double      getFloatAttribute(std::string name);
			bool		getBoolAttribute(std::string name);

			void setDieArea(util::Rect*);
			void setDieArea(util::Point*, util::Point*);

			void addTrack(def::Track*);

			void addGCellGrid(def::GCellGrid*);
			void addComponent(def::Component*);
			void addPin(def::Pin*);
			void addNet(def::Net*);

			std::vector<def::Pin*>*
			getPinVector();
	};
};

#endif
